import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";

@Component({
    selector: 'app-process',
    templateUrl: './process.component.html',
    styleUrls: ['./process.component.less']
})
export class ProcessComponent implements OnInit {

    constructor(public router: Router, public route: ActivatedRoute) {
    }

    ngOnInit() {
    }

    r_1 = false;
    r_2 = false;
    r_3 = false;
    r_4 = false;
    r_5 = false;
    r_6 = false;
    r_7 = false;
    r_8 = false;
    r_9 = false;
    r_10 = false;
    r_11 = false;
    r_12 = false;
    r_13 = false;
    r_14 = false;
    d_1 = false;
    d_2 = false;
    d_3 = false;
    d_4 = false;
    d_5 = false;
    d_6 = false;
    d_7 = false;
    d_8 = false;
    d_9 = false;
    d_10 = false;

    showLine($event) {
        this[$event] = true;
    }

    dragOver($event) {
        $event.preventDefault();
    }

    drop($event) {
        this[$event] = true;
    }

    p_id
    p_data
    p_width
    p_height
    nids = [{label: '默认', value: '2516973426201'},{label: '开始', value: '3516973426201'},{label: '事件', value: '4516973426201'}]
    gids = [
        {label: "辉发", value: "1116973426201", checked: true},
        {label: "三特", value: "1216973458672"},
        {label: "政府", value: "1316973468113"},
        {
            label: "群众",
            value: "1416973477864"
        }
    ]
    currNode=new Node

    gotoScenceEditor() {
        this.currNode.node_id=['2516973426201','3516973426201','4516973426201']
        let tempnids = new Array();
        for (let nid of this.nids) {
            for (let nodeid of this.currNode.node_id) {
                if (nodeid == nid.value) {
                    tempnids.push(nid);
                }
            }
        }
        let data = {
            n_id: this.currNode.id,
            g_id: this.currNode.group_id,
            n_name: this.currNode.text,
            g_name: this.currNode.props.group_text,
            node_id: this.currNode.node_id,
            nids: tempnids,
            p_id: this.p_id,
            p_data: this.p_data,
            gids: this.gids,
            p_width: this.p_width,
            p_height: this.p_height,
            come_list:["1216973458672"]
        }


        this.router.navigate(['xiangmu/full/scene/edit'],
            {
                queryParams: {
                    data: JSON.stringify(data) + ""
                },
                skipLocationChange: true
            })
    }

}
export class Node {
    public id;
    public type;
    public text;
    public group_id;
    public visibleGroup = new Array
    public node_id = new Array<string>();
    public nodes = new Array<Node>();
    public style = new Style();
    public props = new Props();
}

export class Style {

}

export class Props {
    public group_text
    public group_img
    public group_type
    public group_limit
}
